<template>
  <div class="container">
    <h1>首页标题</h1>
    <ChildCom1 />
    <button @click="triggerError">手动触发错误</button>
  </div>
</template>

<script setup>
const triggerError = () => {
  try {
    throw createError({
      statusCode: 404,
      message: "这是一个错误测试",
      fatal: true, // 表明这是一个致命错误
    });
  } catch (e) {
    // 捕获到错误
    clearError();
  }
};
</script>
